package com.dragon.modules.yuegou.query.product;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dragon.modules.yuegou.entity.product.SpuMerchantRefEntity;
import com.dragon.modules.yuegou.mybatis.Condition;
import com.dragon.modules.yuegou.mybatis.Query;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

/**
 * 商品可核销商户 动态查询条件
 * 
 * @author px
 * @date 2019-04-17 14:44:42
 * @version 2.0
 */
@JsonInclude(Include.NON_NULL)
public class SpuMerchantRefQuery extends SpuMerchantRefEntity implements Query<SpuMerchantRefEntity> {

    /** 查询条件 */
	@JsonUnwrapped(prefix = "id")
	private Condition<String> idCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "spuId")
	private Condition<String> spuIdCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "merchantId")
	private Condition<String> merchantIdCondition;

	/**
	 * 构造一个查询条件对象
	 */
	public SpuMerchantRefQuery() {
		super();
	}

	/**
	 * 依据实体对象构造一个查询条件对象
	 * 
	 * @param entity 实体对象
	 */
	public SpuMerchantRefQuery(SpuMerchantRefEntity entity) {
		super(entity);
	}

	/**
	 * 依据其它查询条件对象的信息构造一个查询条件对象
	 * 
	 * @param other 查询条件对象
	 */
	public SpuMerchantRefQuery(SpuMerchantRefQuery other) {
		super(other);
		if(other.idCondition != null) {
			this.idCondition = other.idCondition.copy();
		}
		if(other.spuIdCondition != null) {
			this.spuIdCondition = other.spuIdCondition.copy();
		}
		if(other.merchantIdCondition != null) {
			this.merchantIdCondition = other.merchantIdCondition.copy();
		}
	}

	@Override
	public QueryWrapper<SpuMerchantRefEntity> toQueryWrapper() {
		QueryWrapper<SpuMerchantRefEntity> wrapper = new QueryWrapper<>(this);
		if (idCondition != null) {
			idCondition.toWrapper(wrapper, COL_ID);
		}
		if (spuIdCondition != null) {
			spuIdCondition.toWrapper(wrapper, COL_SPU_ID);
		}
		if (merchantIdCondition != null) {
			merchantIdCondition.toWrapper(wrapper, COL_MERCHANT_ID);
		}
		return wrapper;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> id() {
		this.idCondition = new Condition<>();
		return this.idCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> getIdCondition() {
		return idCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param idCondition 查询条件
	 */
	public void setIdCondition(Condition<String> idCondition) {
		this.idCondition = idCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return spuIdCondition 查询条件
	 */
	public Condition<String> spuId() {
		this.spuIdCondition = new Condition<>();
		return this.spuIdCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return spuIdCondition 查询条件
	 */
	public Condition<String> getSpuIdCondition() {
		return spuIdCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param spuIdCondition 查询条件
	 */
	public void setSpuIdCondition(Condition<String> spuIdCondition) {
		this.spuIdCondition = spuIdCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return merchantIdCondition 查询条件
	 */
	public Condition<String> merchantId() {
		this.merchantIdCondition = new Condition<>();
		return this.merchantIdCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return merchantIdCondition 查询条件
	 */
	public Condition<String> getMerchantIdCondition() {
		return merchantIdCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param merchantIdCondition 查询条件
	 */
	public void setMerchantIdCondition(Condition<String> merchantIdCondition) {
		this.merchantIdCondition = merchantIdCondition;
	}

}
